#include<stdio.h>
int main()
{
    int x,y,z;
    int a,b,c;
    char A,B,C;
    scanf("%d%d%d",&x,&y,&z);
    if(x>y)
    {
        int tmp = x;
        x = y;
        y = tmp;
    }
    if(y>z)
    {
        int tmp = y;
        y = z;
        z= tmp;
    }
    if(x>y)
    {
        int tmp = x;
        x = y;
        y = tmp;
    }
    a = x;
    b = y;
    c = z;
    fflush(stdin);
    scanf("%c%c%c",&A,&B,&C);
    if(A=='A'&&B=='B'&&C=='C')
    {
        printf("%d %d %d",a,b,c);
    }
    else if(A=='A'&&B=='C'&&C=='B')
    {
        printf("%d %d %d",a,c,b);
    }
    else if(A=='B'&&B=='A'&&C=='C')
    {
        printf("%d %d %d",b,a,c);
    }
    else if(A=='B'&&B=='C'&&C=='A')
    {
        printf("%d %d %d",b,c,a);
    }
    else if(A=='C'&&B=='A'&&C=='B')
    {
        printf("%d %d %d",c,a,b);
    }
    else
    {
        printf("%d %d %d",c,b,a);
    }
    return 0;
}